home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / Mac F2C 1.2.2 / Test Project ƒ / test.c (C Output) < prev    next >
Encoding:
Text File  |  1995-03-22  |  18.4 KB  |  602 lines  |  [TEXT/KAHL]

  1. /* test.f -- translated by f2c (version 19941113).
  2.    You must link the resulting object file with the libraries:
  3.     -lf2c -lm   (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /* Table of constant values */
  9.  
  10. static integer c__9 = 9;
  11. static integer c__1 = 1;
  12. static integer c__10 = 10;
  13. static integer c__3 = 3;
  14. static integer c__4 = 4;
  15. static integer c__5 = 5;
  16. static doublereal c_b168 = .33333333333333331;
  17.  
  18. /* Main program */ MAIN__(void)
  19. {
  20.     /* Format strings */
  21.     static char fmt_99[] = "(a1)";
  22.  
  23.     /* Builtin functions */
  24.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  25.         e_wsle(void), s_rsfe(cilist *), do_fio(integer *, char *, ftnlen),
  26.          e_rsfe(void);
  27.     /* Subroutine */ int s_stop(char *, ftnlen);
  28.  
  29.     /* Local variables */
  30.     char junk[2];
  31.     extern /* Subroutine */ int alg_test__(integer *), i_o_test__(void), 
  32.         flt_test__(integer *), int_test__(integer *), trn_test__(void);
  33.  
  34.     /* Fortran I/O blocks */
  35.     static cilist io___1 = { 0, 6, 0, 0, 0 };
  36.     static cilist io___2 = { 0, 6, 0, 0, 0 };
  37.     static cilist io___3 = { 0, 5, 0, fmt_99, 0 };
  38.     static cilist io___5 = { 0, 6, 0, 0, 0 };
  39.     static cilist io___6 = { 0, 6, 0, 0, 0 };
  40.     static cilist io___7 = { 0, 5, 0, fmt_99, 0 };
  41.     static cilist io___8 = { 0, 6, 0, 0, 0 };
  42.     static cilist io___9 = { 0, 6, 0, 0, 0 };
  43.     static cilist io___10 = { 0, 5, 0, fmt_99, 0 };
  44.     static cilist io___11 = { 0, 6, 0, 0, 0 };
  45.     static cilist io___12 = { 0, 6, 0, 0, 0 };
  46.     static cilist io___13 = { 0, 5, 0, fmt_99, 0 };
  47.     static cilist io___14 = { 0, 6, 0, 0, 0 };
  48.     static cilist io___15 = { 0, 6, 0, 0, 0 };
  49.     static cilist io___16 = { 0, 5, 0, fmt_99, 0 };
  50.     static cilist io___17 = { 0, 6, 0, 0, 0 };
  51.     static cilist io___18 = { 0, 6, 0, 0, 0 };
  52.     static cilist io___19 = { 0, 6, 0, 0, 0 };
  53.     static cilist io___20 = { 0, 6, 0, 0, 0 };
  54.     static cilist io___21 = { 0, 6, 0, 0, 0 };
  55.  
  56.  
  57. /*     This is a FORTRAN program to test Mac F2C v1.1 */
  58.     s_wsle(&io___1);
  59.     do_lio(&c__9, &c__1, "*****   Input/Output Test   *****", 33L);
  60.     e_wsle();
  61.     i_o_test__();
  62.     s_wsle(&io___2);
  63.     do_lio(&c__9, &c__1, "\n*****   End of I/O test, hit return to continue."
  64.         "..", 51L);
  65.     e_wsle();
  66.     s_rsfe(&io___3);
  67.     do_fio(&c__1, junk, 2L);
  68.     e_rsfe();
  69.     s_wsle(&io___5);
  70.     do_lio(&c__9, &c__1, "\n*****   Integer Math Test   *****", 34L);
  71.     e_wsle();
  72.     int_test__(&c__10);
  73.     s_wsle(&io___6);
  74.     do_lio(&c__9, &c__1, "\n*****   End of integer math test, hit return to "
  75.         "continue...", 60L);
  76.     e_wsle();
  77.     s_rsfe(&io___7);
  78.     do_fio(&c__1, junk, 2L);
  79.     e_rsfe();
  80.     s_wsle(&io___8);
  81.     do_lio(&c__9, &c__1, "\n*****   Floating Point Math Test   *****", 41L);
  82.     e_wsle();
  83.     flt_test__(&c__10);
  84.     s_wsle(&io___9);
  85.     do_lio(&c__9, &c__1, "\n*****   End of floating point math test, hit ret"
  86.         "urn to continue...", 67L);
  87.     e_wsle();
  88.     s_rsfe(&io___10);
  89.     do_fio(&c__1, junk, 2L);
  90.     e_rsfe();
  91.     s_wsle(&io___11);
  92.     do_lio(&c__9, &c__1, "\n*****   Algebraic Function Test   *****", 40L);
  93.     e_wsle();
  94.     alg_test__(&c__10);
  95.     s_wsle(&io___12);
  96.     do_lio(&c__9, &c__1, "\n*****   End of algebraic function test, hit retu"
  97.         "rn to continue...", 66L);
  98.     e_wsle();
  99.     s_rsfe(&io___13);
  100.     do_fio(&c__1, junk, 2L);
  101.     e_rsfe();
  102.     s_wsle(&io___14);
  103.     do_lio(&c__9, &c__1, "\n*****   Transcendental Function Test   *****", 
  104.         45L);
  105.     e_wsle();
  106.     trn_test__();
  107.     s_wsle(&io___15);
  108.     do_lio(&c__9, &c__1, "\n*****   End of transcendental function test, hit"
  109.         " return to continue...", 71L);
  110.     e_wsle();
  111.     s_rsfe(&io___16);
  112.     do_fio(&c__1, junk, 2L);
  113.     e_rsfe();
  114.     s_wsle(&io___17);
  115.     do_lio(&c__9, &c__1, "##################################################"
  116.         "########################", 74L);
  117.     e_wsle();
  118.     s_wsle(&io___18);
  119.     do_lio(&c__9, &c__1, " If you noticed that floating point values did not"
  120.         " round correctly when", 71L);
  121.     e_wsle();
  122.     s_wsle(&io___19);
  123.     do_lio(&c__9, &c__1, " displayed, please read the enclosed file \"If Flo"
  124.         "ats Don't Display Right\"", 73L);
  125.     e_wsle();
  126.     s_wsle(&io___20);
  127.     do_lio(&c__9, &c__1, "##################################################"
  128.         "########################", 74L);
  129.     e_wsle();
  130.     s_wsle(&io___21);
  131.     do_lio(&c__9, &c__1, "\n*****   This completes all of the tests   *****", 
  132.         48L);
  133.     e_wsle();
  134.     s_stop("", 0L);
  135.     return 0;
  136. } /* MAIN__ */
  137.  
  138. /**************************************************************************/
  139.  
  140. /*     Subroutine to do the I/O tests */
  141.  
  142. /**************************************************************************/
  143. /* Subroutine */ int i_o_test__(void)
  144. {
  145.     /* Format strings */
  146.     static char fmt_399[] = "(a1)";
  147.     static char fmt_304[] = "(5x,a20,5(i1,2x),5x,5(f4.2,2x))";
  148.  
  149.     /* System generated locals */
  150.     olist o__1;
  151.     cllist cl__1;
  152.  
  153.     /* Builtin functions */
  154.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  155.         e_wsle(void), s_rsle(cilist *), e_rsle(void), s_rsfe(cilist *), 
  156.         do_fio(integer *, char *, ftnlen), e_rsfe(void);
  157.     void s_copy(char *, char *, ftnlen, ftnlen);
  158.     integer f_open(olist *), s_wsue(cilist *), do_uio(integer *, char *, 
  159.         ftnlen), e_wsue(void), f_clos(cllist *), s_wsfe(cilist *), e_wsfe(
  160.         void), s_rsue(cilist *), e_rsue(void);
  161.  
  162.     /* Local variables */
  163.     char text[40];
  164.     real a[5];
  165.     integer i, j[5];
  166.     real x;
  167.     doublereal dx;
  168.  
  169.     /* Fortran I/O blocks */
  170.     static cilist io___22 = { 0, 6, 0, 0, 0 };
  171.     static cilist io___23 = { 0, 5, 0, 0, 0 };
  172.     static cilist io___25 = { 0, 6, 0, 0, 0 };
  173.     static cilist io___26 = { 0, 6, 0, 0, 0 };
  174.     static cilist io___27 = { 0, 5, 0, 0, 0 };
  175.     static cilist io___29 = { 0, 6, 0, 0, 0 };
  176.     static cilist io___30 = { 0, 6, 0, 0, 0 };
  177.     static cilist io___31 = { 0, 5, 0, 0, 0 };
  178.     static cilist io___33 = { 0, 6, 0, 0, 0 };
  179.     static cilist io___34 = { 0, 6, 0, 0, 0 };
  180.     static cilist io___35 = { 0, 5, 0, 0, 0 };
  181.     static cilist io___37 = { 0, 6, 0, 0, 0 };
  182.     static cilist io___38 = { 0, 6, 0, 0, 0 };
  183.     static cilist io___39 = { 0, 5, 0, fmt_399, 0 };
  184.     static cilist io___42 = { 0, 60, 0, 0, 0 };
  185.     static cilist io___43 = { 0, 6, 0, 0, 0 };
  186.     static cilist io___44 = { 0, 6, 0, fmt_304, 0 };
  187.     static cilist io___45 = { 0, 50, 0, 0, 0 };
  188.     static cilist io___46 = { 0, 6, 0, 0, 0 };
  189.     static cilist io___47 = { 0, 6, 0, fmt_304, 0 };
  190.  
  191.  
  192. /*     Screen I/O tests */
  193.     s_wsle(&io___22);
  194.     do_lio(&c__9, &c__1, "\nPart 1:  Screen I/O tests.\n\nEnter an integer v"
  195.         "alue.", 52L);
  196.     e_wsle();
  197.     s_rsle(&io___23);
  198.     do_lio(&c__3, &c__1, (char *)&i, (ftnlen)sizeof(integer));
  199.     e_rsle();
  200.     s_wsle(&io___25);
  201.     do_lio(&c__9, &c__1, "The number you entered was:", 27L);
  202.     do_lio(&c__3, &c__1, (char *)&i, (ftnlen)sizeof(integer));
  203.     e_wsle();
  204.     s_wsle(&io___26);
  205.     do_lio(&c__9, &c__1, "\nEnter a single precision floating point value...",
  206.          49L);
  207.     e_wsle();
  208.     s_rsle(&io___27);
  209.     do_lio(&c__4, &c__1, (char *)&x, (ftnlen)sizeof(real));
  210.     e_rsle();
  211.     s_wsle(&io___29);
  212.     do_lio(&c__9, &c__1, "The number you entered was: ", 28L);
  213.     do_lio(&c__4, &c__1, (char *)&x, (ftnlen)sizeof(real));
  214.     e_wsle();
  215.     s_wsle(&io___30);
  216.     do_lio(&c__9, &c__1, "\nEnter a double precision floating point value...",
  217.          49L);
  218.     e_wsle();
  219.     s_rsle(&io___31);
  220.     do_lio(&c__5, &c__1, (char *)&dx, (ftnlen)sizeof(doublereal));
  221.     e_rsle();
  222.     s_wsle(&io___33);
  223.     do_lio(&c__9, &c__1, "The number you entered was: ", 28L);
  224.     do_lio(&c__5, &c__1, (char *)&dx, (ftnlen)sizeof(doublereal));
  225.     e_wsle();
  226.     s_wsle(&io___34);
  227.     do_lio(&c__9, &c__1, "\nEnter some text (40 char max)...", 33L);
  228.     e_wsle();
  229.     s_rsle(&io___35);
  230.     do_lio(&c__9, &c__1, text, 40L);
  231.     e_rsle();
  232.     s_wsle(&io___37);
  233.     do_lio(&c__9, &c__1, "The text you entered was: ", 26L);
  234.     do_lio(&c__9, &c__1, text, 40L);
  235.     e_wsle();
  236.     s_wsle(&io___38);
  237.     do_lio(&c__9, &c__1, "\nPart 2:  file I/O tests.  Hit return to continue"
  238.         "...", 52L);
  239.     e_wsle();
  240.     s_rsfe(&io___39);
  241.     do_fio(&c__1, text, 40L);
  242.     e_rsfe();
  243. /*     File I/O tests:  Store some values and write them to file */
  244.     for (i = 1; i <= 5; ++i) {
  245.     j[i - 1] = i;
  246.     a[i - 1] = (doublereal) i;
  247.     }
  248.     s_copy(text, "A test message.", 40L, 15L);
  249.     o__1.oerr = 0;
  250.     o__1.ounit = 60;
  251.     o__1.ofnmlen = 8;
  252.     o__1.ofnm = "test.dat";
  253.     o__1.orl = 0;
  254.     o__1.osta = 0;
  255.     o__1.oacc = 0;
  256.     o__1.ofm = "unformatted";
  257.     o__1.oblnk = 0;
  258.     f_open(&o__1);
  259.     s_wsue(&io___42);
  260.     do_uio(&c__1, text, 40L);
  261.     do_uio(&c__5, (char *)&j[0], (ftnlen)sizeof(integer));
  262.     do_uio(&c__5, (char *)&a[0], (ftnlen)sizeof(real));
  263.     e_wsue();
  264.     cl__1.cerr = 0;
  265.     cl__1.cunit = 60;
  266.     cl__1.csta = 0;
  267.     f_clos(&cl__1);
  268.     s_wsle(&io___43);
  269.     do_lio(&c__9, &c__1, "Wrote the following data to file test.dat:\n", 43L);
  270.     e_wsle();
  271.     s_wsfe(&io___44);
  272.     do_fio(&c__1, text, 40L);
  273.     for (i = 1; i <= 5; ++i) {
  274.     do_fio(&c__1, (char *)&j[i - 1], (ftnlen)sizeof(integer));
  275.     }
  276.     for (i = 1; i <= 5; ++i) {
  277.     do_fio(&c__1, (char *)&a[i - 1], (ftnlen)sizeof(real));
  278.     }
  279.     e_wsfe();
  280. /* Reset the variables and read them back */
  281.     for (i = 1; i <= 5; ++i) {
  282.     j[i - 1] = 99;
  283.     a[i - 1] = 99.f;
  284.     }
  285.     s_copy(text, "reset", 40L, 5L);
  286.     o__1.oerr = 0;
  287.     o__1.ounit = 50;
  288.     o__1.ofnmlen = 8;
  289.     o__1.ofnm = "test.dat";
  290.     o__1.orl = 0;
  291.     o__1.osta = 0;
  292.     o__1.oacc = 0;
  293.     o__1.ofm = "unformatted";
  294.     o__1.oblnk = 0;
  295.     f_open(&o__1);
  296.     s_rsue(&io___45);
  297.     do_uio(&c__1, text, 40L);
  298.     do_uio(&c__5, (char *)&j[0], (ftnlen)sizeof(integer));
  299.     do_uio(&c__5, (char *)&a[0], (ftnlen)sizeof(real));
  300.     e_rsue();
  301.     cl__1.cerr = 0;
  302.     cl__1.cunit = 50;
  303.     cl__1.csta = 0;
  304.     f_clos(&cl__1);
  305.     s_wsle(&io___46);
  306.     do_lio(&c__9, &c__1, "\nRead the following data from file test.dat:\n", 
  307.         45L);
  308.     e_wsle();
  309.     s_wsfe(&io___47);
  310.     do_fio(&c__1, text, 40L);
  311.     for (i = 1; i <= 5; ++i) {
  312.     do_fio(&c__1, (char *)&j[i - 1], (ftnlen)sizeof(integer));
  313.     }
  314.     for (i = 1; i <= 5; ++i) {
  315.     do_fio(&c__1, (char *)&a[i - 1], (ftnlen)sizeof(real));
  316.     }
  317.     e_wsfe();
  318.     return 0;
  319. } /* i_o_test__ */
  320.  
  321. /**************************************************************************/
  322.  
  323. /*     Subroutine to do the integer math tests */
  324.  
  325. /**************************************************************************/
  326. /* Subroutine */ int int_test__(integer *m)
  327. {
  328.     /* Format strings */
  329.     static char fmt_203[] = "(10x,\002n\002,5x,\002n^2\002,5x,\002n^3\002,"
  330.         "5x,\002n/2\002,3x,\002n^2/2\002,3x,\002n^3/2\002)";
  331.     static char fmt_202[] = "(5x,6(i6,2x))";
  332.  
  333.     /* System generated locals */
  334.     integer i__1, i__2, i__3, i__4;
  335.  
  336.     /* Builtin functions */
  337.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  338.         e_wsle(void), s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, 
  339.         char *, ftnlen);
  340.  
  341.     /* Local variables */
  342.     integer i, j, k;
  343.  
  344.     /* Fortran I/O blocks */
  345.     static cilist io___48 = { 0, 6, 0, 0, 0 };
  346.     static cilist io___49 = { 0, 6, 0, fmt_203, 0 };
  347.     static cilist io___53 = { 0, 6, 0, fmt_202, 0 };
  348.  
  349.  
  350.     s_wsle(&io___48);
  351.     do_lio(&c__9, &c__1, "\nGenerate a table of integers, squares, cubes, an"
  352.         "d their halves.\n", 65L);
  353.     e_wsle();
  354.     s_wsfe(&io___49);
  355.     e_wsfe();
  356.     i__1 = *m;
  357.     for (i = 1; i <= i__1; ++i) {
  358. /* Computing 2nd power */
  359.     i__2 = i;
  360.     j = i__2 * i__2;
  361. /* Computing 3rd power */
  362.     i__2 = i, i__3 = i__2;
  363.     k = i__3 * (i__2 * i__2);
  364.     s_wsfe(&io___53);
  365.     do_fio(&c__1, (char *)&i, (ftnlen)sizeof(integer));
  366.     do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
  367.     do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
  368.     i__2 = i / 2;
  369.     do_fio(&c__1, (char *)&i__2, (ftnlen)sizeof(integer));
  370.     i__3 = j / 2;
  371.     do_fio(&c__1, (char *)&i__3, (ftnlen)sizeof(integer));
  372.     i__4 = k / 2;
  373.     do_fio(&c__1, (char *)&i__4, (ftnlen)sizeof(integer));
  374.     e_wsfe();
  375.     }
  376.     return 0;
  377. } /* int_test__ */
  378.  
  379. /**************************************************************************/
  380.  
  381. /*     Subroutine to do the floating point math tests */
  382.  
  383. /**************************************************************************/
  384. /* Subroutine */ int flt_test__(integer *m)
  385. {
  386.     /* Format strings */
  387.     static char fmt_205[] = "(12x,\002x\002,6x,\002x^2\002,6x,\002x^3\002,"
  388.         "6x,\002x/2\002,4x,\002x^2/2\002,4x,\002x^3/2\002)";
  389.     static char fmt_201[] = "(5x,6(f8.2,1x))";
  390.  
  391.     /* System generated locals */
  392.     integer i__1;
  393.     real r__1, r__2, r__3;
  394.  
  395.     /* Builtin functions */
  396.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  397.         e_wsle(void), s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, 
  398.         char *, ftnlen);
  399.  
  400.     /* Local variables */
  401.     integer i;
  402.     real x1, x2, x3;
  403.  
  404.     /* Fortran I/O blocks */
  405.     static cilist io___54 = { 0, 6, 0, 0, 0 };
  406.     static cilist io___55 = { 0, 6, 0, fmt_205, 0 };
  407.     static cilist io___60 = { 0, 6, 0, fmt_201, 0 };
  408.  
  409.  
  410.     s_wsle(&io___54);
  411.     do_lio(&c__9, &c__1, "\nGenerate a table of floats, their squares, cubes"
  412.         ", and their halves.\n", 69L);
  413.     e_wsle();
  414.     s_wsfe(&io___55);
  415.     e_wsfe();
  416.     i__1 = *m;
  417.     for (i = 1; i <= i__1; ++i) {
  418.     x1 = i * 1.f;
  419. /* Computing 2nd power */
  420.     r__1 = x1;
  421.     x2 = r__1 * r__1;
  422. /* Computing 3rd power */
  423.     r__1 = x1, r__2 = r__1;
  424.     x3 = r__2 * (r__1 * r__1);
  425.     s_wsfe(&io___60);
  426.     do_fio(&c__1, (char *)&x1, (ftnlen)sizeof(real));
  427.     do_fio(&c__1, (char *)&x2, (ftnlen)sizeof(real));
  428.     do_fio(&c__1, (char *)&x3, (ftnlen)sizeof(real));
  429.     r__1 = x1 / 2;
  430.     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
  431.     r__2 = x2 / 2;
  432.     do_fio(&c__1, (char *)&r__2, (ftnlen)sizeof(real));
  433.     r__3 = x3 / 2;
  434.     do_fio(&c__1, (char *)&r__3, (ftnlen)sizeof(real));
  435.     e_wsfe();
  436.     }
  437.     return 0;
  438. } /* flt_test__ */
  439.  
  440. /**************************************************************************/
  441.  
  442. /*     Subroutine to do the algebraic function tests */
  443.  
  444. /**************************************************************************/
  445. /* Subroutine */ int alg_test__(integer *m)
  446. {
  447.     /* Format strings */
  448.     static char fmt_305[] = "(10x,\002x\002,7x,\002SQRT(x)\002,4x,\002CURT"
  449.         "(x)\002,3x,\002SQRT(x)^2\002,2x,\002CURT(x)^3\002)";
  450.     static char fmt_301[] = "(5x,6(f9.6,2x))";
  451.  
  452.     /* System generated locals */
  453.     integer i__1;
  454.     real r__1, r__2, r__3, r__4, r__5;
  455.     doublereal d__1;
  456.  
  457.     /* Builtin functions */
  458.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  459.         e_wsle(void), s_wsfe(cilist *), e_wsfe(void);
  460.     double sqrt(doublereal), pow_dd(doublereal *, doublereal *);
  461.     integer do_fio(integer *, char *, ftnlen);
  462.  
  463.     /* Local variables */
  464.     integer i;
  465.     real x1, x2, x3;
  466.  
  467.     /* Fortran I/O blocks */
  468.     static cilist io___61 = { 0, 6, 0, 0, 0 };
  469.     static cilist io___62 = { 0, 6, 0, fmt_305, 0 };
  470.     static cilist io___67 = { 0, 6, 0, fmt_301, 0 };
  471.  
  472.  
  473.     s_wsle(&io___61);
  474.     do_lio(&c__9, &c__1, "\nGenerate a table of floats, square & cube roots,"
  475.         " and their squares & cubes.\n", 77L);
  476.     e_wsle();
  477.     s_wsfe(&io___62);
  478.     e_wsfe();
  479.     i__1 = *m;
  480.     for (i = 1; i <= i__1; ++i) {
  481.     x1 = i * 1.f;
  482.     x2 = sqrt(x1);
  483.     d__1 = (doublereal) x1;
  484.     x3 = pow_dd(&d__1, &c_b168);
  485.     s_wsfe(&io___67);
  486.     do_fio(&c__1, (char *)&x1, (ftnlen)sizeof(real));
  487.     do_fio(&c__1, (char *)&x2, (ftnlen)sizeof(real));
  488.     do_fio(&c__1, (char *)&x3, (ftnlen)sizeof(real));
  489. /* Computing 2nd power */
  490.     r__2 = x2;
  491.     r__1 = r__2 * r__2;
  492.     do_fio(&c__1, (char *)&r__1, (ftnlen)sizeof(real));
  493. /* Computing 3rd power */
  494.     r__4 = x3, r__5 = r__4;
  495.     r__3 = r__5 * (r__4 * r__4);
  496.     do_fio(&c__1, (char *)&r__3, (ftnlen)sizeof(real));
  497.     e_wsfe();
  498.     }
  499.     return 0;
  500. } /* alg_test__ */
  501.  
  502. /**************************************************************************/
  503.  
  504. /*     Subroutine to do the transcendental function tests */
  505.  
  506. /**************************************************************************/
  507. /* Subroutine */ int trn_test__(void)
  508. {
  509.     /* Format strings */
  510.     static char fmt_207[] = "(9x,\002x\002,9x,\002sin(x)\002,8x,\002cos(x"
  511.         ")\002,4x,\002sin(x)^2 + cos(x)^2\002)";
  512.     static char fmt_200[] = "(5x,i2,\002*pi/6\0023x,f11.8,3x,f11.8,3x,f15.10)"
  513.         ;
  514.     static char fmt_299[] = "(a1)";
  515.     static char fmt_208[] = "(11x,\002x\002,16x,\002log(x)\002,9x,\002exp(lo"
  516.         "g(x))\002)";
  517.     static char fmt_201[] = "(5x,f13.10,5x,f13.10,5x,f13.10)";
  518.  
  519.     /* System generated locals */
  520.     doublereal d__1;
  521.  
  522.     /* Builtin functions */
  523.     integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
  524.         e_wsle(void), s_wsfe(cilist *), e_wsfe(void);
  525.     double sin(doublereal), cos(doublereal);
  526.     integer do_fio(integer *, char *, ftnlen), s_rsfe(cilist *), e_rsfe(void);
  527.     double log(doublereal), exp(doublereal);
  528.  
  529.     /* Local variables */
  530.     char junk[2];
  531.     doublereal c;
  532.     integer i;
  533.     doublereal s, x, c2, s2, pi;
  534.  
  535.     /* Fortran I/O blocks */
  536.     static cilist io___69 = { 0, 6, 0, 0, 0 };
  537.     static cilist io___70 = { 0, 6, 0, 0, 0 };
  538.     static cilist io___71 = { 0, 6, 0, fmt_207, 0 };
  539.     static cilist io___78 = { 0, 6, 0, fmt_200, 0 };
  540.     static cilist io___79 = { 0, 6, 0, 0, 0 };
  541.     static cilist io___80 = { 0, 5, 0, fmt_299, 0 };
  542.     static cilist io___82 = { 0, 6, 0, 0, 0 };
  543.     static cilist io___83 = { 0, 6, 0, fmt_208, 0 };
  544.     static cilist io___84 = { 0, 6, 0, fmt_201, 0 };
  545.  
  546.  
  547.     pi = 3.141592653589793f;
  548.     s_wsle(&io___69);
  549.     do_lio(&c__9, &c__1, "\nPart 1: Trig Functions", 23L);
  550.     e_wsle();
  551.     s_wsle(&io___70);
  552.     do_lio(&c__9, &c__1, "\nGenerate a table of x, sin(x), cos(x) and the su"
  553.         "m of their squares.\n", 69L);
  554.     e_wsle();
  555.     s_wsfe(&io___71);
  556.     e_wsfe();
  557.     for (i = 1; i <= 12; ++i) {
  558.     x = i * pi / 6.f;
  559.     s = sin(x);
  560.     c = cos(x);
  561. /* Computing 2nd power */
  562.     d__1 = s;
  563.     s2 = d__1 * d__1;
  564. /* Computing 2nd power */
  565.     d__1 = c;
  566.     c2 = d__1 * d__1;
  567.     s_wsfe(&io___78);
  568.     do_fio(&c__1, (char *)&i, (ftnlen)sizeof(integer));
  569.     do_fio(&c__1, (char *)&s, (ftnlen)sizeof(doublereal));
  570.     do_fio(&c__1, (char *)&c, (ftnlen)sizeof(doublereal));
  571.     d__1 = s2 + c2;
  572.     do_fio(&c__1, (char *)&d__1, (ftnlen)sizeof(doublereal));
  573.     e_wsfe();
  574.     }
  575.     s_wsle(&io___79);
  576.     do_lio(&c__9, &c__1, "\nPart 2:  Exponential functions; hit return to co"
  577.         "ntinue...", 58L);
  578.     e_wsle();
  579.     s_rsfe(&io___80);
  580.     do_fio(&c__1, junk, 2L);
  581.     e_rsfe();
  582.     s_wsle(&io___82);
  583.     do_lio(&c__9, &c__1, "Generate a table of x, log(x), and exp(log(x))\n", 
  584.         47L);
  585.     e_wsle();
  586.     s_wsfe(&io___83);
  587.     e_wsfe();
  588.     for (i = 1; i <= 10; ++i) {
  589.     x = (doublereal) i;
  590.     s = log(x);
  591.     c = exp(s);
  592.     s_wsfe(&io___84);
  593.     do_fio(&c__1, (char *)&x, (ftnlen)sizeof(doublereal));
  594.     do_fio(&c__1, (char *)&s, (ftnlen)sizeof(doublereal));
  595.     do_fio(&c__1, (char *)&c, (ftnlen)sizeof(doublereal));
  596.     e_wsfe();
  597.     }
  598.     return 0;
  599. } /* trn_test__ */
  600.  
  601. /* Main program alias */ int test_f2c__ () { MAIN__ (); return 0; }
  602.